package com.itheima.d5_resource;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/*
     目标：掌握释放资源的方式。
 */
public class Test {
    
    public static void main(String[] args)  {

        try(FileInputStream fis  = new FileInputStream("D:\\p图\\孙\\脸部.jpg");
        FileOutputStream fos = new FileOutputStream("脸部.jpg")) {
            int len;
            byte[] bytes = new byte[1024];
            while((len = fis.read(bytes)) != -1){
                fos.write(bytes, 0, len);
            }

        } catch (Exception e) {
           e.printStackTrace();
        }
    }
}
